\(\int \frac {1}{\sqrt {1-\cos (c+d x)} \sqrt {\cos (c+d x)}} \, dx\) [285]

   Optimal result
   Rubi [A] (verified)
   Mathematica [C] (verified)
   Maple [B] (verified)
   Fricas [B] (verification not implemented)
   Sympy [F]
   Maxima [C] (verification not implemented)
   Giac [B] (verification not implemented)
   Mupad [F(-1)]

Optimal result

Integrand size = 25, antiderivative size = 47 \[ \int \frac {1}{\sqrt {1-\cos (c+d x)} \sqrt {\cos (c+d x)}} \, dx=-\frac {\sqrt {2} \text {arctanh}\left (\frac {\sin (c+d x)}{\sqrt {2} \sqrt {1-\cos (c+d x)} \sqrt {\cos (c+d x)}}\right )}{d} \]

[Out]

-arctanh(1/2*sin(d*x+c)*2^(1/2)/(1-cos(d*x+c))^(1/2)/cos(d*x+c)^(1/2))*2^(1/2)/d

Rubi [A] (verified)

Time = 0.06 (sec) , antiderivative size = 47, normalized size of antiderivative = 1.00, number of steps used = 2, number of rules used = 2, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.080, Rules used = {2861, 212} \[ \int \frac {1}{\sqrt {1-\cos (c+d x)} \sqrt {\cos (c+d x)}} \, dx=-\frac {\sqrt {2} \text {arctanh}\left (\frac {\sin (c+d x)}{\sqrt {2} \sqrt {1-\cos (c+d x)} \sqrt {\cos (c+d x)}}\right )}{d} \]

[In]

Int[1/(Sqrt[1 - Cos[c + d*x]]*Sqrt[Cos[c + d*x]]),x]

[Out]

-((Sqrt[2]*ArcTanh[Sin[c + d*x]/(Sqrt[2]*Sqrt[1 - Cos[c + d*x]]*Sqrt[Cos[c + d*x]])])/d)

Rule 212

Int[((a_) + (b_.)*(x_)^2)^(-1), x_Symbol] :> Simp[(1/(Rt[a, 2]*Rt[-b, 2]))*ArcTanh[Rt[-b, 2]*(x/Rt[a, 2])], x]
 /; FreeQ[{a, b}, x] && NegQ[a/b] && (GtQ[a, 0] || LtQ[b, 0])

Rule 2861

Int[1/(Sqrt[(a_) + (b_.)*sin[(e_.) + (f_.)*(x_)]]*Sqrt[(c_.) + (d_.)*sin[(e_.) + (f_.)*(x_)]]), x_Symbol] :> D
ist[-2*(a/f), Subst[Int[1/(2*b^2 - (a*c - b*d)*x^2), x], x, b*(Cos[e + f*x]/(Sqrt[a + b*Sin[e + f*x]]*Sqrt[c +
 d*Sin[e + f*x]]))], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && EqQ[a^2 - b^2, 0] && NeQ[c^2 -
 d^2, 0]

Rubi steps \begin{align*} \text {integral}& = -\frac {2 \text {Subst}\left (\int \frac {1}{2-x^2} \, dx,x,\frac {\sin (c+d x)}{\sqrt {1-\cos (c+d x)} \sqrt {\cos (c+d x)}}\right )}{d} \\ & = -\frac {\sqrt {2} \text {arctanh}\left (\frac {\sin (c+d x)}{\sqrt {2} \sqrt {1-\cos (c+d x)} \sqrt {\cos (c+d x)}}\right )}{d} \\ \end{align*}

Mathematica [C] (verified)

Result contains complex when optimal does not.

Time = 0.19 (sec) , antiderivative size = 110, normalized size of antiderivative = 2.34 \[ \int \frac {1}{\sqrt {1-\cos (c+d x)} \sqrt {\cos (c+d x)}} \, dx=\frac {i e^{-i (c+d x)} \left (-1+e^{i (c+d x)}\right ) \sqrt {1+e^{2 i (c+d x)}} \text {arctanh}\left (\frac {1+e^{i (c+d x)}}{\sqrt {2} \sqrt {1+e^{2 i (c+d x)}}}\right )}{\sqrt {2} d \sqrt {-((-1+\cos (c+d x)) \cos (c+d x))}} \]

[In]

Integrate[1/(Sqrt[1 - Cos[c + d*x]]*Sqrt[Cos[c + d*x]]),x]

[Out]

(I*(-1 + E^(I*(c + d*x)))*Sqrt[1 + E^((2*I)*(c + d*x))]*ArcTanh[(1 + E^(I*(c + d*x)))/(Sqrt[2]*Sqrt[1 + E^((2*
I)*(c + d*x))])])/(Sqrt[2]*d*E^(I*(c + d*x))*Sqrt[-((-1 + Cos[c + d*x])*Cos[c + d*x])])

Maple [B] (verified)

Leaf count of result is larger than twice the leaf count of optimal. \(83\) vs. \(2(40)=80\).

Time = 5.84 (sec) , antiderivative size = 84, normalized size of antiderivative = 1.79

method result size
default \(\frac {4 \sqrt {\frac {\cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}\, \left (\cos \left (d x +c \right )-1\right ) \sin \left (d x +c \right ) \operatorname {arctanh}\left (\frac {\sqrt {2}}{2 \sqrt {\frac {\cos \left (d x +c \right )}{1+\cos \left (d x +c \right )}}}\right )}{d \sqrt {\cos \left (d x +c \right )}\, \left (-2 \cos \left (d x +c \right )+2\right )^{\frac {3}{2}}}\) \(84\)

[In]

int(1/(1-cos(d*x+c))^(1/2)/cos(d*x+c)^(1/2),x,method=_RETURNVERBOSE)

[Out]

4/d*(cos(d*x+c)/(1+cos(d*x+c)))^(1/2)*(cos(d*x+c)-1)*sin(d*x+c)*arctanh(1/2*2^(1/2)/(cos(d*x+c)/(1+cos(d*x+c))
)^(1/2))/cos(d*x+c)^(1/2)/(-2*cos(d*x+c)+2)^(3/2)

Fricas [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 84 vs. \(2 (40) = 80\).

Time = 0.27 (sec) , antiderivative size = 84, normalized size of antiderivative = 1.79 \[ \int \frac {1}{\sqrt {1-\cos (c+d x)} \sqrt {\cos (c+d x)}} \, dx=\frac {\sqrt {2} \log \left (-\frac {2 \, {\left (\sqrt {2} \cos \left (d x + c\right ) + \sqrt {2}\right )} \sqrt {-\cos \left (d x + c\right ) + 1} \sqrt {\cos \left (d x + c\right )} - {\left (3 \, \cos \left (d x + c\right ) + 1\right )} \sin \left (d x + c\right )}{{\left (\cos \left (d x + c\right ) - 1\right )} \sin \left (d x + c\right )}\right )}{2 \, d} \]

[In]

integrate(1/(1-cos(d*x+c))^(1/2)/cos(d*x+c)^(1/2),x, algorithm="fricas")

[Out]

1/2*sqrt(2)*log(-(2*(sqrt(2)*cos(d*x + c) + sqrt(2))*sqrt(-cos(d*x + c) + 1)*sqrt(cos(d*x + c)) - (3*cos(d*x +
 c) + 1)*sin(d*x + c))/((cos(d*x + c) - 1)*sin(d*x + c)))/d

Sympy [F]

\[ \int \frac {1}{\sqrt {1-\cos (c+d x)} \sqrt {\cos (c+d x)}} \, dx=\int \frac {1}{\sqrt {1 - \cos {\left (c + d x \right )}} \sqrt {\cos {\left (c + d x \right )}}}\, dx \]

[In]

integrate(1/(1-cos(d*x+c))**(1/2)/cos(d*x+c)**(1/2),x)

[Out]

Integral(1/(sqrt(1 - cos(c + d*x))*sqrt(cos(c + d*x))), x)

Maxima [C] (verification not implemented)

Result contains complex when optimal does not.

Time = 0.38 (sec) , antiderivative size = 248, normalized size of antiderivative = 5.28 \[ \int \frac {1}{\sqrt {1-\cos (c+d x)} \sqrt {\cos (c+d x)}} \, dx=\frac {\sqrt {2} \log \left (\frac {4 \, {\left ({\left | i \, e^{\left (i \, d x + i \, c\right )} - i \right |}^{2} + 2 \, \sqrt {\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1} {\left (\cos \left (\frac {1}{2} \, \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right )\right )^{2} + \sin \left (\frac {1}{2} \, \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right )\right )^{2}\right )} - 2 \, {\left (\sqrt {2} {\left | i \, e^{\left (i \, d x + i \, c\right )} - i \right |} \sin \left (\frac {1}{2} \, \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right )\right ) - 2 \, \sqrt {2} \cos \left (\frac {1}{2} \, \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right )\right )\right )} {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{4}} + 4\right )}}{{\left | i \, e^{\left (i \, d x + i \, c\right )} - i \right |}^{2}}\right )}{2 \, d} \]

[In]

integrate(1/(1-cos(d*x+c))^(1/2)/cos(d*x+c)^(1/2),x, algorithm="maxima")

[Out]

1/2*sqrt(2)*log(4*(abs(I*e^(I*d*x + I*c) - I)^2 + 2*sqrt(cos(2*d*x + 2*c)^2 + sin(2*d*x + 2*c)^2 + 2*cos(2*d*x
 + 2*c) + 1)*(cos(1/2*arctan2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1))^2 + sin(1/2*arctan2(sin(2*d*x + 2*c), c
os(2*d*x + 2*c) + 1))^2) - 2*(sqrt(2)*abs(I*e^(I*d*x + I*c) - I)*sin(1/2*arctan2(sin(2*d*x + 2*c), cos(2*d*x +
 2*c) + 1)) - 2*sqrt(2)*cos(1/2*arctan2(sin(2*d*x + 2*c), cos(2*d*x + 2*c) + 1)))*(cos(2*d*x + 2*c)^2 + sin(2*
d*x + 2*c)^2 + 2*cos(2*d*x + 2*c) + 1)^(1/4) + 4)/abs(I*e^(I*d*x + I*c) - I)^2)/d

Giac [B] (verification not implemented)

Leaf count of result is larger than twice the leaf count of optimal. 159 vs. \(2 (40) = 80\).

Time = 0.48 (sec) , antiderivative size = 159, normalized size of antiderivative = 3.38 \[ \int \frac {1}{\sqrt {1-\cos (c+d x)} \sqrt {\cos (c+d x)}} \, dx=\frac {\sqrt {2} {\left (\log \left (\tan \left (\frac {1}{4} \, d x + \frac {1}{4} \, c\right )^{2} - \sqrt {\tan \left (\frac {1}{4} \, d x + \frac {1}{4} \, c\right )^{4} - 6 \, \tan \left (\frac {1}{4} \, d x + \frac {1}{4} \, c\right )^{2} + 1} + 1\right ) - \log \left ({\left | -\tan \left (\frac {1}{4} \, d x + \frac {1}{4} \, c\right )^{2} + \sqrt {\tan \left (\frac {1}{4} \, d x + \frac {1}{4} \, c\right )^{4} - 6 \, \tan \left (\frac {1}{4} \, d x + \frac {1}{4} \, c\right )^{2} + 1} + 3 \right |}\right ) - \log \left ({\left | -\tan \left (\frac {1}{4} \, d x + \frac {1}{4} \, c\right )^{2} + \sqrt {\tan \left (\frac {1}{4} \, d x + \frac {1}{4} \, c\right )^{4} - 6 \, \tan \left (\frac {1}{4} \, d x + \frac {1}{4} \, c\right )^{2} + 1} + 1 \right |}\right )\right )}}{2 \, d \mathrm {sgn}\left (\sin \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )} \]

[In]

integrate(1/(1-cos(d*x+c))^(1/2)/cos(d*x+c)^(1/2),x, algorithm="giac")

[Out]

1/2*sqrt(2)*(log(tan(1/4*d*x + 1/4*c)^2 - sqrt(tan(1/4*d*x + 1/4*c)^4 - 6*tan(1/4*d*x + 1/4*c)^2 + 1) + 1) - l
og(abs(-tan(1/4*d*x + 1/4*c)^2 + sqrt(tan(1/4*d*x + 1/4*c)^4 - 6*tan(1/4*d*x + 1/4*c)^2 + 1) + 3)) - log(abs(-
tan(1/4*d*x + 1/4*c)^2 + sqrt(tan(1/4*d*x + 1/4*c)^4 - 6*tan(1/4*d*x + 1/4*c)^2 + 1) + 1)))/(d*sgn(sin(1/2*d*x
 + 1/2*c)))

Mupad [F(-1)]

Timed out. \[ \int \frac {1}{\sqrt {1-\cos (c+d x)} \sqrt {\cos (c+d x)}} \, dx=\int \frac {1}{\sqrt {\cos \left (c+d\,x\right )}\,\sqrt {1-\cos \left (c+d\,x\right )}} \,d x \]

[In]

int(1/(cos(c + d*x)^(1/2)*(1 - cos(c + d*x))^(1/2)),x)

[Out]

int(1/(cos(c + d*x)^(1/2)*(1 - cos(c + d*x))^(1/2)), x)